home *** CD-ROM | disk | FTP | other *** search
/ Business Assistant / Business Assistant.iso / indus / rental / addb.prg < prev    next >
Text File  |  1986-05-30  |  21KB  |  717 lines

  1. **    Last revision: May 27, 1986 at 19:09
  2. * addb.prg
  3. STOR 'A' TO choice
  4. CLEA
  5. TEXT
  6.  
  7.     Welcome to the 'ADD' Menu.  We can now add new buildings to the
  8.     data file - or add new tenants to existing buildings already in
  9.     the data base.                                               
  10.                                                                        
  11.     Note that when you add a building, you will be given the option
  12.     of adding the tenants or the units at the same time.
  13.  
  14.           <A> add a new building                                    
  15.           <B> add tenants to a building already in the data base
  16.           <C> return to main menu without adding
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. ENDT
  29. @ 13,10 SAY 'How shall we proceed ? '
  30. @ 13,42 GET choice picture '!'
  31. READ
  32. DO WHIL AT(choice, 'ABC') = 0
  33.  @ 13,42 GET choice PICTURE '!'
  34.  READ
  35.  CLEA GETS
  36. ENDD while AT(choice)
  37. DO CASE
  38. CASE choice = 'A'
  39. * this program will add records to the current files
  40.  STOR .t. TO first
  41.  STOR .t. TO more
  42.  SET INTENSITY ON
  43.  SET DELIMITER OFF
  44.  DO WHIL more
  45. * set up screen for data entry
  46.   IF first
  47.    DO b_first
  48.    STOR .f. TO first
  49.   ENDI
  50.   STOR 'Add Building Records' TO mode
  51.   STOR 'First enter data about the building. You then will be able to' TO prompt1
  52.   STOR 'enter tenant data before you enter another building.' TO prompt2
  53.   STOR "To terminate session leave building blank and hit control 'Q'or 'W'" TO prompt3
  54. * get a set of default memory variables for data entry
  55.   STOR SPACE(50) TO blnks
  56.   STOR SUBSTR(blnks,1,35) TO mbaddr
  57.   STOR SUBSTR(blnks,1,2) TO mbcode
  58.   STOR SUBSTR(blnks,1,20) TO mbcity
  59.   STOR SUBSTR(blnks,1,2) TO mbst
  60.   STOR SUBSTR(blnks,1,5) TO mbzip
  61.   STOR SUBSTR(blnks,1,25) TO mbmgr
  62.   STOR SUBSTR(blnks,1,13) TO mbphone
  63.   STOR SUBSTR(blnks,1,2) TO mbtype
  64.   STOR SUBSTR(blnks,1,3) TO mbunit
  65.   STOR SUBSTR(blnks,1,8) TO mbacq
  66.   STOR 0 TO mbprice
  67.   STOR SUBSTR(blnks,1,35) TO mremit
  68.   STOR SUBSTR(blnks,1,13) TO mphone
  69.   STOR SUBSTR(blnks,1,35) TO mremitad
  70.   STOR SUBSTR(blnks,1,35) TO mremitc
  71.   STOR SUBSTR(blnks,1,50) TO mchecks
  72.   STOR SUBSTR(blnks,1,50) TO mbnotes
  73.   STOR DTOC(date()) TO mbupdate
  74. * let user enter data
  75.   @ 1,26 SAY mode
  76.   @ 3,10 GET mbaddr
  77.   @ 3,61 GET mbcode PICTURE '99'
  78.   @ 4,10 GET mbcity
  79.   @ 4,44 GET mbst PICTURE '!!'
  80.   @ 4,61 GET mbzip PICTURE '99999'
  81.   @ 6,10 GET mbmgr
  82.   @ 6,61 GET mbphone PICTURE '(999)999-9999'
  83.   @ 7,10 GET mbtype
  84.   @ 7,61 GET mbunit
  85.   @ 9,10 GET mbacq PICTURE '99/99/99'
  86.   @ 9,61 GET mbprice
  87.   @ 12,10 GET mremit
  88.   @ 12,61 GET mphone PICTURE '(999)999-9999'
  89.   @ 13,10 GET mremitad
  90.   @ 14,10 GET mremitc
  91.   @ 15,10 GET mchecks
  92.   @ 17,10 GET mbnotes
  93.   @ 18,61 GET mbupdate PICTURE '99/99/99'
  94.   @ 20, 4 SAY prompt1
  95.   @ 21, 4 SAY prompt2
  96.   @ 22, 4 SAY prompt3
  97.   READ
  98.   CLEA GETS
  99. * if a building was entered
  100. * add a new record with the entered data
  101.   IF mbaddr <> ' '
  102. * validation
  103. * this module validates added records
  104. * test if there is a bad field validation
  105.    DO CASE
  106.    CASE mbcode = ' '
  107. * no building code
  108.     STOR .t. TO error
  109.    OTHE
  110.     STOR .f. TO error
  111.    ENDC
  112. * if test for error was true then fix the fields that need fixing
  113.    IF error
  114. * erase the lines to be used for prompts
  115.     @ 01,00
  116.     @ 20,00
  117.     @ 21,00
  118.     @ 22,00
  119. * tell them to correct it
  120.     @ 1,18 SAY 'Please Correct the Indicated Data'
  121. * keep looping until all fields are fixed
  122.     STOR .t. to an_error
  123.     DO WHIL an_error
  124.      DO CASE
  125.      CASE mbcode = ' '
  126.       @ 20,15 SAY 'Must have a building code                              '
  127.       @ 03,61 GET mbcode PICTURE '99'
  128.       READ
  129.      OTHE
  130.       STOR .f. TO an_error
  131.      ENDC
  132.     ENDD while an:error
  133.    ENDI error
  134.    RELE error, an_error
  135.    SET DELIMITER ON
  136.    SET INTENSITY OFF
  137.    STOR 'N' TO command
  138.    @ 20,01 SAY SPACE(75)
  139.    @ 21,01 SAY SPACE(75)
  140.    @ 22,01 SAY SPACE(75)
  141.    @ 20,15 SAY 'Are there any more changes ?                        '
  142.    @ 20,48 GET command picture '!'
  143.    READ
  144.    SET DELIMITER OFF
  145.    SET INTENSITY ON
  146.    IF command = 'Y'
  147.     @ 1,00
  148.     @ 1,26 SAY mode
  149.     @ 3,10 GET mbaddr
  150.     @ 3,61 GET mbcode PICTURE '99'
  151.     @ 4,10 GET mbcity
  152.     @ 4,44 GET mbst PICTURE '!!'
  153.     @ 4,61 GET mbzip PICTURE '99999'
  154.     @ 6,10 GET mbmgr
  155.     @ 6,61 GET mbphone PICTURE '(999)999-9999'
  156.     @ 7,10 GET mbtype
  157.     @ 7,61 GET mbunit
  158.     @ 9,10 GET mbacq PICTURE '99/99/99'
  159.     @ 9,61 GET mbprice
  160.     @ 12,10 GET mremit
  161.     @ 12,61 GET mphone PICTURE '(999)999-9999'
  162.     @ 13,10 GET mremitad
  163.     @ 14,10 GET mremitc
  164.     @ 15,10 GET mchecks
  165.     @ 17,10 GET mbnotes
  166.     @ 18,61 GET mbupdate PICTURE '99/99/99'
  167.     @ 20,01 SAY SPACE(75)
  168.     @ 21,01 SAY SPACE(75)
  169.     @ 22,01 SAY SPACE(75)
  170.     @ 20,04 SAY prompt1
  171.     @ 21,04 SAY prompt2
  172.     @ 22,04 SAY prompt3
  173.     READ
  174.     CLEA GETS
  175.    ENDI command = 'Y'
  176. * add new record
  177.    APPE BLANK
  178.    REPL baddr WITH mbaddr, bcode WITH mbcode
  179.    REPL bcity WITH mbcity+mbst+mbzip
  180.    REPL bdata WITH mbmgr+mbphone+mbtype+mbunit+mbacq
  181.    REPL bprice WITH mbprice, remit WITH mremit, phone WITH mphone
  182.    REPL remitad WITH mremitad, remitc WITH mremitc
  183.    REPL checks WITH mchecks, bnotes with mbnotes, bupdate WITH mbupdate
  184.    RELE mbcity, mbst, mbzip, mbmgr, mbphone, mbtype, mbunit, mbacq
  185.    RELE mbprice, mremit, mphone, mremitad, mremitc
  186.    RELE mchecks, mbnotes, mode, prompt1, prompt2, prompt3
  187.    SELE B
  188.    USE &dr.:tenant
  189.    SET INDEX TO &dr.:codea
  190.    STOR .t. TO more1
  191.    STOR .t. TO first
  192.    CLEA
  193.    DO WHIL more1
  194.     IF first
  195.      DO t_first
  196.      STOR .f. TO first
  197.     ENDI
  198.     STOR 'Add Tenant Records' TO mode
  199.     STOR 'Enter as many tenants as you want. When done, enter a blank for tenant' TO prompt1
  200.     STOR "name and unit or control 'Q' or 'W' to end session." TO prompt2
  201.     STOR SUBSTR(blnks,1,35) TO mtenant
  202.     STOR SUBSTR(blnks,1,3) TO mtcode
  203.     STOR SUBSTR(blnks,1,5) to mtunit
  204.     STOR 'R' TO mttype
  205.     STOR SUBSTR(blnks,1,25) TO mtcontac
  206.     STOR SUBSTR(blnks,1,13) TO mtphone
  207.     STOR 'N' TO malt
  208.     STOR SUBSTR(blnks,1,35) TO maltad
  209.     STOR SUBSTR(blnks,1,35) TO maltcty
  210.     STOR SUBSTR(blnks,1,8) TO mtexpir
  211.     STOR SUBSTR(blnks,1,8) TO mtfirst
  212.     STOR 0 TO mtsec
  213.     STOR SUBSTR(blnks,1,4) TO mtsecb
  214.     STOR SUBSTR(blnks,1,2) TO mtlate
  215.     STOR 0 TO mtrent
  216.     STOR 0.0000 TO mtrentpc
  217.     STOR 0 TO mtrenpcr
  218.     STOR 0 TO mtlatec
  219.     STOR 0 TO mtaddl
  220.     STOR 0 TO mtrente
  221.     STOR 0 TO mtrentm
  222.     STOR 0 TO mtrentd
  223.     STOR SUBSTR(blnks,1,8) TO mtrentpd
  224.     STOR 0 TO mtrentp
  225.     STOR 0 TO mtrenty
  226.     STOR 0 TO mtrentt
  227.     STOR SUBSTR(blnks,1,8) TO mtflag
  228.     STOR SUBSTR(blnks,1,35) TO mtnotes
  229.     STOR mbupdate TO mtupdate
  230. * setup gets to read data
  231.     @ 1,26 SAY mode
  232.     @ 3,10 GET mtenant
  233.     @ 3,62 SAY mbcode
  234.     @ 3,64 GET mtcode PICTURE '999'
  235.     @ 4,10 GET mtunit
  236.     @ 4,36 SAY mbaddr
  237.     @ 5,10 GET mtcontac
  238.     @ 5,62 GET mtphone PICTURE '(999)999-9999'
  239.     @ 6,36 GET malt PICTURE '!'
  240.     @ 7,10 GET maltad
  241.     @ 8,10 GET maltcty
  242.     @ 10,10 GET mttype PICTURE '!'
  243.     @ 10,36 GET mtrentpc
  244.     @ 10,62 GET mtfirst PICTURE '99/99/99'
  245.     @ 11,10 GET mtrenpcr
  246.     @ 11,62 GET mtexpir PICTURE '99/99/99'
  247.     @ 12,10 GET mtsec
  248.     @ 12,36 GET mtsecb
  249.     @ 12,62 GET mtlate PICTURE '99'
  250.     @ 13,10 GET mtrent
  251.     @ 13,36 GET mtlatec
  252.     @ 13,62 GET mtaddl
  253.     @ 14,10 GET mtrente
  254.     @ 14,36 GET mtrentm
  255.     @ 15,10 GET mtrentd
  256.     @ 15,36 GET mtrentp PICTURE '99/99/99'
  257.     @ 15,62 GET mtrentp
  258.     @ 16,10 GET mtrenty
  259.     @ 16,36 GET mtflag PICTURE '99/99/99'
  260.     @ 16,62 GET mtrentt
  261.     @ 18,10 GET mtnotes
  262.     @ 18,61 GET mtupdate PICTURE '99/99/99'
  263.     @ 20,01 SAY SPACE(75)
  264.     @ 21,01 SAY SPACE(75)
  265.     @ 22,01 SAY SPACE(75)
  266.     @ 20, 7 SAY prompt1
  267.     @ 21, 7 SAY prompt2
  268.     READ
  269.     CLEA GETS
  270. * test if there is a bad field validation
  271.     IF mtenant <> ' '
  272. * validation
  273.      DO CASE
  274.      CASE mtcode = ' '
  275.       STOR .t. TO error
  276.      CASE .NOT.(malt = 'Y' .OR. malt = 'N')
  277.       STOR .t. TO error
  278.      CASE .NOT.(mttype = 'R'.OR.mttype='P'.OR. mttype='O')
  279.       STOR .t. TO error
  280.      CASE (mttype = 'P'.OR. mttype = 'O') .AND.(.NOT.(mtr